package concept.misc;

class InnerException extends Exception
{
	public InnerException(String message)
	{
		super(message);
	}
}

class OuterException extends Exception
{
	public OuterException(Throwable t)
	{
		super(t);
	}
}

public class ExceptionLab
{
	public static void main(String... strings)
	{
		/*try
		{
			throw new InnerException("Can you see me?");
		}
		catch(Exception e)
		{
			OuterException oe = new OuterException(e);
			System.out.println(oe.getMessage());
		}*/
		
		//Without catch, the correct order will be 
		//[Hello Throwit End java.lang.RuntimeException]
		try
		{
			System.out.println("Hello");
			throwit();
		}
		/*catch(Exception e)
		{
			System.out.println("Caughtit");
		}*/
		finally
		{
			System.out.println("End");
		}
		System.out.println("Done");
	}

	private static void throwit()
	{
		System.out.println("Throwit ");
		throw new RuntimeException();
	}
}
